import { Controller, Post, HttpCode, HttpStatus, Body } from '@nestjs/common';
import { UserService } from './user.service';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { UserRegisterDto } from './dto/user-register.dto';
import { UserLoginDto } from './dto/user-login.dto';

@ApiTags('前台用户模块')
@Controller('blog/user')
export class UserController {
  constructor(private readonly service: UserService) {}

  @Post('login')
  @HttpCode(HttpStatus.OK)
  @ApiOperation({ summary: '登录' })
  login(@Body() data: UserLoginDto) {
    return this.service.loginService(data);
  }

  @Post('register')
  @HttpCode(HttpStatus.OK)
  @ApiOperation({ summary: '注册' })
  register(@Body() data: UserRegisterDto) {
    return this.service.registerService(data);
  }
}
